from kubernetes import client, config
import os
config.kube_config.load_kube_config(config_file='config')

class K8s:
    def __init__(self):
        self.connect = client.CoreV1Api()

    def ListNameSpace(self):
        data = []
        print(self.connect.list_namespace().items[0].metadata)
        for ns in self.connect.list_namespace().items:
            data.append(ns.metadata.name)
        return data

    def ListPod(self):
        data = {}
        return self.connect.list_pod_for_all_namespaces().items[0].to_dict().keys()

if __name__ == "__main__":
    k8s = K8s()
    print(k8s.ListPod())

